package com.hyt.it.ogt.ykcj.service.exam.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hyt.it.ogt.ykcj.domain.exam.ExamPostScoreLineSettingSub;
import com.hyt.it.ogt.ykcj.mapper.exam.ExamPostScoreLineSettingSubMapper;
import com.hyt.it.ogt.ykcj.service.exam.IChangedExamInfoService;
import com.hyt.it.ogt.ykcj.service.exam.IExamPostScoreLineSettingSubService;

/**
 * 招考职位分数线设置科目分数Service业务层处理
 * 
 * @author admin
 * @date 2021-09-09
 */
@Service
public class ExamPostScoreLineSettingSubServiceImpl implements IExamPostScoreLineSettingSubService
{
    @Autowired
    private ExamPostScoreLineSettingSubMapper examPostScoreLineSettingSubMapper;

    @Autowired
    private IChangedExamInfoService changedExamInfoService;

    /**
     * 查询招考职位分数线设置科目分数
     *
     * @param id 招考职位分数线设置科目分数ID
     * @return 招考职位分数线设置科目分数
     */
    @Override
    public ExamPostScoreLineSettingSub selectExamPostScoreLineSettingSubById(String id)
    {
        return examPostScoreLineSettingSubMapper.selectExamPostScoreLineSettingSubById(id);
    }

    /**
     * 查询招考职位分数线设置科目分数列表
     *
     * @param examPostScoreLineSettingSub 招考职位分数线设置科目分数
     * @return 招考职位分数线设置科目分数
     */
    @Override
    public List<ExamPostScoreLineSettingSub> selectExamPostScoreLineSettingSubList(ExamPostScoreLineSettingSub examPostScoreLineSettingSub)
    {
        return examPostScoreLineSettingSubMapper.selectExamPostScoreLineSettingSubList(examPostScoreLineSettingSub);
    }

    /**
     * 新增招考职位分数线设置科目分数
     *
     * @param examPostScoreLineSettingSub 招考职位分数线设置科目分数
     * @return 结果
     */
    @Override
    public int insertExamPostScoreLineSettingSub(ExamPostScoreLineSettingSub examPostScoreLineSettingSub)
    {
        //添加考试变更信息
        String examId = examPostScoreLineSettingSubMapper.getExamIdById(examPostScoreLineSettingSub.getId());
        changedExamInfoService.addChangedExamInfo(examId);
        return examPostScoreLineSettingSubMapper.insertExamPostScoreLineSettingSub(examPostScoreLineSettingSub);
    }

    /**
     * 修改招考职位分数线设置科目分数
     *
     * @param examPostScoreLineSettingSub 招考职位分数线设置科目分数
     * @return 结果
     */
    @Override
    public int updateExamPostScoreLineSettingSub(ExamPostScoreLineSettingSub examPostScoreLineSettingSub)
    {
        //添加考试变更信息
        String examId = examPostScoreLineSettingSubMapper.getExamIdById(examPostScoreLineSettingSub.getId());
        changedExamInfoService.addChangedExamInfo(examId);
        return examPostScoreLineSettingSubMapper.updateExamPostScoreLineSettingSub(examPostScoreLineSettingSub);
    }

    /**
     * 批量删除招考职位分数线设置科目分数
     *
     * @param ids 需要删除的招考职位分数线设置科目分数ID
     * @return 结果
     */
    @Override
    public int deleteExamPostScoreLineSettingSubByIds(String[] ids)
    {
        //添加考试变更信息
        String examId = examPostScoreLineSettingSubMapper.getExamIdById(ids[0]);
        changedExamInfoService.addChangedExamInfo(examId);
        return examPostScoreLineSettingSubMapper.deleteExamPostScoreLineSettingSubByIds(ids);
    }

    /**
     * 删除招考职位分数线设置科目分数信息
     *
     * @param id 招考职位分数线设置科目分数ID
     * @return 结果
     */
    @Override
    public int deleteExamPostScoreLineSettingSubById(String id)
    {
        //添加考试变更信息
        String examId = examPostScoreLineSettingSubMapper.getExamIdById(id);
        changedExamInfoService.addChangedExamInfo(examId);
        return examPostScoreLineSettingSubMapper.deleteExamPostScoreLineSettingSubById(id);
    }
}
